import 'package:flutter/material.dart';

class ProfileIndex extends StatefulWidget {
  const ProfileIndex({super.key});

  @override
  State<StatefulWidget> createState() => _ProfileIndexState();
}

class _ProfileIndexState extends State {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          children: [
            Center(child: Text("个人中心", style: TextStyle(fontSize: 24))),
            //渐变背景用图片
            Expanded(
              child: Container(
                color: Color.fromRGBO(240, 240, 240, 1),
                child: Stack(
                  children: [
                    Image.network(
                      'https://img02.hua.com/m/2021_img/label-grade-1-new.png',
                      width: double.infinity,
                    ),
                    // 个人信息
                    Expanded(
                      child: Column(
                        children: [
                          // 个人头像信息
                          Container(
                            padding: EdgeInsets.symmetric(
                              horizontal: 30,
                              vertical: 20,
                            ),
                            child: GestureDetector(
                              onTap: () {
                                Navigator.pushNamed(
                                  context,
                                  '/account/sms_login',
                                );
                              },
                              child: Row(
                                children: [
                                  Image.network(
                                    'https://img02.hua.com/wxmp/hua/def_user_header.png',
                                    width: 70,
                                  ),
                                  Column(
                                    children: [
                                      Container(
                                        padding: EdgeInsets.symmetric(
                                          horizontal: 10,
                                        ),
                                        child: Column(
                                          crossAxisAlignment:
                                              CrossAxisAlignment.start,
                                          children: [
                                            Text('请登录/注册您的账号'),
                                            Text('点击登录'),
                                          ],
                                        ),
                                      ),
                                    ],
                                  ),
                                ],
                              ),
                            ),
                          ),
                          // 我的订单
                          Container(
                            decoration: BoxDecoration(
                              color: Colors.white, // 背景色
                              borderRadius: BorderRadius.circular(15.0), // 统一圆角
                            ),
                            margin: EdgeInsets.fromLTRB(30, 20, 30, 7.5),
                            height: 140,
                            child: GestureDetector(
                              onTap: () => {
                                // print('单击事件');
                                Navigator.pushNamed(
                                  context,
                                  '/profile/my/order',
                                ),
                              },
                              // onDoubleTap: () => print('双击事件'),
                              // onLongPress: () => print('长按事件'),
                              child: Column(
                                children: [
                                  Padding(
                                    padding: EdgeInsets.only(
                                      top: 10,
                                      left: 15,
                                      right: 15,
                                    ),
                                    child: Row(
                                      mainAxisAlignment:
                                          MainAxisAlignment.spaceBetween,
                                      children: [
                                        Text(
                                          '我的订单',
                                          style: TextStyle(
                                            fontSize: 18,
                                            fontWeight: FontWeight.w700,
                                          ),
                                        ),
                                        Text('全部订单 >'),
                                      ],
                                    ),
                                  ),
                                  Divider(
                                    height: 20, // 分割线区域高度
                                    thickness: 1, // 线宽（逻辑像素）
                                    color: Colors.grey, // 颜色
                                  ),
                                  Padding(
                                    padding: EdgeInsets.symmetric(
                                      vertical: 5,
                                      horizontal: 10,
                                    ),
                                    child: Row(
                                      mainAxisAlignment:
                                          MainAxisAlignment.spaceAround,
                                      children: [
                                        Column(
                                          children: [
                                            Image.network(
                                              'https://img12.360buyimg.com/img/s60x60_jfs/t1/144453/3/26543/2290/62651dc1E9a870916/9d55698157214416.png',
                                              width: 40,
                                            ),
                                            Text('待付款'),
                                          ],
                                        ),
                                        Column(
                                          children: [
                                            Image.network(
                                              'https://img12.360buyimg.com/img/s60x60_jfs/t1/216515/34/18229/3273/6267c3dfE721548af/18e0a2427b75b3a7.png.webp',
                                              width: 40,
                                            ),
                                            Text('待付款'),
                                          ],
                                        ),
                                        Column(
                                          children: [
                                            Image.network(
                                              'https://img12.360buyimg.com/img/s60x60_jfs/t1/149388/24/26816/2914/62651dc1E1d5a859d/1e9d70ebcaa01281.png',
                                              width: 40,
                                            ),
                                            Text('待付款'),
                                          ],
                                        ),
                                      ],
                                    ),
                                  ),
                                ],
                              ),
                            ),
                          ),
                          // 其他记录
                          Container(
                            height: 80,
                            decoration: BoxDecoration(
                              color: Colors.white, // 背景色
                              borderRadius: BorderRadius.circular(15.0), // 统一圆角
                            ),
                            margin: EdgeInsets.symmetric(
                              vertical: 7.5,
                              horizontal: 30,
                            ),
                            child: Padding(
                              padding: EdgeInsets.symmetric(
                                vertical: 5,
                                horizontal: 15,
                              ),
                              child: Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  Column(
                                    mainAxisAlignment: MainAxisAlignment.center,
                                    children: [
                                      Text(
                                        '0',
                                        style: TextStyle(
                                          fontSize: 24,
                                          fontWeight: FontWeight.w900,
                                        ),
                                      ),
                                      Container(
                                        padding: EdgeInsets.symmetric(
                                          vertical: 5,
                                        ),
                                        child: Text('积分'),
                                      ),
                                    ],
                                  ),
                                  Column(
                                    mainAxisAlignment: MainAxisAlignment.center,
                                    children: [
                                      Text(
                                        '0',
                                        style: TextStyle(
                                          fontSize: 24,
                                          fontWeight: FontWeight.w900,
                                        ),
                                      ),
                                      Container(
                                        padding: EdgeInsets.symmetric(
                                          vertical: 5,
                                        ),
                                        child: Text('优惠券'),
                                      ),
                                    ],
                                  ),
                                  GestureDetector(
                                    onTap: () {
                                      Navigator.pushNamed(
                                        context,
                                        '/profile/my/collect',
                                      );
                                    },
                                    child: Column(
                                      mainAxisAlignment:
                                          MainAxisAlignment.center,
                                      children: [
                                        Text(
                                          '0',
                                          style: TextStyle(
                                            fontSize: 24,
                                            fontWeight: FontWeight.w900,
                                          ),
                                        ),
                                        Container(
                                          padding: EdgeInsets.symmetric(
                                            vertical: 5,
                                          ),
                                          child: Text('收藏'),
                                        ),
                                      ],
                                    ),
                                  ),
                                  GestureDetector(
                                    onTap: () {
                                      Navigator.pushNamed(
                                        context,
                                        '/profile/my/history',
                                      );
                                    },
                                    child: Column(
                                      mainAxisAlignment:
                                          MainAxisAlignment.center,
                                      children: [
                                        Text(
                                          '0',
                                          style: TextStyle(
                                            fontSize: 24,
                                            fontWeight: FontWeight.w900,
                                          ),
                                        ),
                                        Container(
                                          padding: EdgeInsets.symmetric(
                                            vertical: 5,
                                          ),
                                          child: Text('足迹'),
                                        ),
                                      ],
                                    ),
                                  ),
                                ],
                              ),
                            ),
                          ),
                          //地址管理
                          Container(
                            decoration: BoxDecoration(
                              color: Colors.white, // 背景色
                              borderRadius: BorderRadius.circular(15.0), // 统一圆角
                            ),
                            margin: EdgeInsets.symmetric(
                              vertical: 7.5,
                              horizontal: 30,
                            ),
                            child: Padding(
                              padding: EdgeInsets.symmetric(
                                vertical: 5,
                                horizontal: 15,
                              ),
                              child: Row(
                                children: [
                                  GestureDetector(
                                    onTap: () => {
                                      // print('单击事件');
                                      Navigator.pushNamed(
                                        context,
                                        '/profile/address/index',
                                      ),
                                    },
                                    // onDoubleTap: () => print('双击事件'),
                                    // onLongPress: () => print('长按事件'),
                                    child: Column(
                                      children: [
                                        Image.network(
                                          "https://img12.360buyimg.com/jdphoto/jfs/t9196/304/2362310772/2730/775aea35/59cc5931Nd495934f.png",
                                          width: 50,
                                        ),
                                        Text(
                                          '地址管理',
                                          style: TextStyle(fontSize: 16),
                                        ),
                                      ],
                                    ),
                                  ),
                                ],
                              ),
                            ),
                          ),
                        ],
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
